<?php
$this->pageTitle = Yii::app()->name . ' - ' . UserModule::t("Thay đổi mật khẩu");
?>


<div class="span12">
    <div class="row-fluid">
        <div class="span2">
            <?php echo $this->renderPartial('menu'); ?>
        </div>
        <div class="span10">
            <?php
            $this->widget('bootstrap.widgets.TbBreadcrumbs', array(
                'links' => array('Quản lý thông tin' => 'profile', 'Thông đổi thông tin'),
                'htmlOptions' => array('id' => 'breadcrumb')
            ));
            ?>
            <?php if (Yii::app()->user->hasFlash('profileMessage')): ?>
                <div class="success">
                    <?php echo Yii::app()->user->getFlash('profileMessage'); ?>
                </div>
            <?php endif; ?>
            <div class="notice">

                <?php
                $form = $this->beginWidget('CActiveForm', array(
                    'id' => 'login-form',
                    'enableAjaxValidation' => FALSE,
                    'htmlOptions' => array("class" => "form-horizontal well"),
                ));
                ?>

                <?php
                echo CHtml::errorSummary($model);
                echo CHtml::errorSummary($profile);
                ?>

                <?php
                $profileFields = $profile->getFields();
                if ($profileFields) {
                    foreach ($profileFields as $field) {
                        ?>
                        <div class="control-group">
                            <?php
                            echo $form->labelEx($profile, $field->varname, array('class' => 'control-label'));
                            echo '<div class="controls">';
                            if ($field->widgetEdit($profile)) {
                                echo $field->widgetEdit($profile);
                            } elseif ($field->range) {
                                echo CHtml::activeDropDownList($profile, $field->varname, Profile::range($field->range));
                            } elseif ($field->field_type == "TEXT") {
                                echo CHtml::activeTextArea($profile, $field->varname, array('rows' => 6, 'cols' => 50));
                            } else {
                                echo CHtml::activeTextField($profile, $field->varname, array('size' => 60, 'maxlength' => (($field->field_size) ? $field->field_size : 255)));
                            }
                            echo CHtml::error($profile, $field->varname);
                            ?>
                        </div>
                    </div>	
                    <?php
                }
            }
            ?>
            <div class="control-group">
                <?php echo $form->labelEx($model, 'username', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->textField($model, 'username'); ?>
                    <?php echo $form->error($model, 'username'); ?>
                </div>
            </div>

            <div class="control-group">
                <?php echo $form->labelEx($model, 'email', array('class' => 'control-label')); ?>
                <div class="controls">
                    <?php echo $form->textField($model, 'email'); ?>
                    <?php echo $form->error($model, 'email'); ?>
                </div>
            </div>

            <div class="control-group">
                <div class="controls">
                    <?php echo CHtml::submitButton($model->isNewRecord ? UserModule::t('Create') : UserModule::t('Hoàn thành'), array('class' => 'btn btn-success')); ?>
                </div>
            </div>

            <?php $this->endWidget(); ?>

        </div><!-- form -->
    </div>
</div>
</div>